<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
</head>

<body layadmin-themealias="default">

    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body" pad15="">

                        <div class="layui-form" wid100="" lay-filter="">
                            <div class="layui-form" wid200="">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">弹窗标题</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="title" value="" class="layui-input"
                                            lay-verify="required" />
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">观看时长(分)</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="timeout" value="" class="layui-input"
                                            lay-verify="required" placeholder="分" />
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">强制注册模式</label>
                                    <div class="layui-input-block">
                                        <input type="radio" value="2" name="force_reg" title="关闭" />
                                        <input type="radio" checked value="1" name="force_reg" title="开启" />
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">每日触发次数</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="daily_times" value="" class="layui-input"
                                            lay-verify="required" placeholder="" />
                                    </div>
                                </div>
                                <div class="layui-form-item" id="img1">
                                    <label class="layui-form-label">WEB端配置</label>
                                    <div class="layui-input-inline" style="width: 400px">
                                        <input name="web_image" lay-verify="" id="LAY_iconImgSrc" placeholder="图片地址"
                                            value="" class="layui-input" />
                                    </div>
                                    <div class="layui-input-inline layui-btn-container" style="width: auto">
                                        <button type="button" class="layui-btn layui-btn-primary"
                                            id="LAY_iconImgUpload">
                                            <i class="layui-icon">&#xe67c;</i>上传图片
                                        </button>
                                    </div>
                                </div>
                                <div class="layui-form-item" id="img2">
                                    <label class="layui-form-label">移动端横屏</label>
                                    <div class="layui-input-inline" style="width: 400px">
                                        <input name="mobile_image_h" lay-verify="" id="LAY_iconImgSrc1"
                                            placeholder="图片地址" value="" class="layui-input" />
                                    </div>
                                    <div class="layui-input-inline layui-btn-container" style="width: auto">
                                        <button type="button" class="layui-btn layui-btn-primary"
                                            id="LAY_iconImgUpload1">
                                            <i class="layui-icon">&#xe67c;</i>上传图片
                                        </button>
                                    </div>
                                </div>
                                <div class="layui-form-item" id="img3">
                                    <label class="layui-form-label">移动端竖屏</label>
                                    <div class="layui-input-inline" style="width: 400px">
                                        <input name="mobile_image_v" lay-verify="" id="LAY_iconImgSrc2"
                                            placeholder="图片地址" value="" class="layui-input" />
                                    </div>
                                    <div class="layui-input-inline layui-btn-container" style="width: auto">
                                        <button type="button" class="layui-btn layui-btn-primary"
                                            id="LAY_iconImgUpload2">
                                            <i class="layui-icon">&#xe67c;</i>上传图片
                                        </button>
                                    </div>
                                </div>
                                <div class="layui-form-item" pane="">
                                    <label class="layui-form-label">弹窗端口</label>
                                    <div class="layui-input-block">
                                        <input type="checkbox" name="dialog_switch[]" lay-skin="primary" value="1"
                                            title="PC">
                                        <input type="checkbox" name="dialog_switch[]" lay-skin="primary" value="2"
                                            title="H5">
                                        <input type="checkbox" name="dialog_switch[]" lay-skin="primary" value="4"
                                            title="IOS">
                                        <input type="checkbox" name="dialog_switch[]" lay-skin="primary" value="8"
                                            title="安卓">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-block text-center">
                                        <button class="layui-btn" lay-submit="" lay-filter="userrec-add">确认保存</button>
                                        <button class="layui-btn layui-btn-primary" id="close">取消</button>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="/assets/cos-js-sdk-v5/cos-js-sdk-v5.js"></script>
        <script src="/layuiadmin/layui/layui.js"></script>
        <script>
            layui.config({
                base: '/layuiadmin/' //静态资源所在路径
            }).extend({
                index: 'lib/index' //主入口模块
            }).use(['index', 'form', 'admin', 'userrec', 'laydate', 'dialog_config'], function () {
                var $ = layui.$
                    , form = layui.form
                    , admin = layui.admin
                    , laydate = layui.laydate;

                //执行一个laydate实例
                laydate.render({
                    elem: '#start_time_input',
                    type: 'date'
                });
                laydate.render({
                    elem: '#end_time_input',
                    type: 'date'
                });

                var index = parent.layer.getFrameIndex(window.name);

                $('#close').on("click", function () {
                    parent.layer.close(index);
                });

                form.on('submit(userrec-add)', function (obj) {
                    //提交
                    admin.req({
                        url: '/admin/dialog_config/save'
                        , data: obj.field
                        , success: function (res) {
                            if (res.code == 0) {
                                parent.layer.close(index);
                                parent.layer.msg(res.msg, { icon: 1 });
                                parent.layui.table.reload('LAY-userrec-manage');
                            }
                        }
                    });
                    return false;
                });
            });
        </script>
</body>

</html>